package cpuspeedandharddisk;

public class cpuspeedandharddisk {

    public static class CPU {
        int speed;

        int getSpeed() {
            return speed;
        }

        public void setSpeed(int speed) {
            this.speed = speed;
        }
    }

    public static class HardDisk {
        int amount;

        int getAmount() {
            return amount;
        }

        public void setAmount(int amount) {
            this.amount = amount;
        }
    }

    public static class PC {
        CPU cpu;
        HardDisk hd; // 通常变量名应该使用小写字母开头，以符合Java的命名约定

        void setCPU(CPU cpu) {
            this.cpu = cpu;
        }

        void setHardDisk(HardDisk hd) {
            this.hd = hd;
        }

        void show() {
            System.out.println("CPU Speed: " + cpu.getSpeed());
            System.out.println("HardDisk Amount: " + hd.getAmount());
        }
    }

    public static class Test {
        public static void main(String[] args) {
            CPU cpu = new CPU();
            HardDisk hd = new HardDisk();

            cpu.setSpeed(2200);
            hd.setAmount(200);

            PC pc = new PC();

            pc.setCPU(cpu);
            pc.setHardDisk(hd);

            pc.show();
        }
    }
}
